{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"d2d0945b-c6fd-4f4a-bb42-052f3e78a85c\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(global) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = \"1\";\n",
       "\n",
       "  if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force !== \"\") {\n",
       "    window._bokeh_onload_callbacks = [];\n",
       "    window._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  function run_callbacks() {\n",
       "    window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    delete window._bokeh_onload_callbacks\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    window._bokeh_onload_callbacks.push(callback);\n",
       "    if (window._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    window._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        window._bokeh_is_loading--;\n",
       "        if (window._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  var js_urls = ['https://cdn.pydata.org/bokeh/release/bokeh-0.12.1.min.js', 'https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.1.min.js', 'https://cdn.pydata.org/bokeh/release/bokeh-compiler-0.12.1.min.js'];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      Bokeh.$(\"#d2d0945b-c6fd-4f4a-bb42-052f3e78a85c\").text(\"BokehJS successfully loaded\");\n",
       "      var kernel = Jupyter.notebook.kernel\n",
       "      if (kernel.execute !== undefined) {\n",
       "          kernel.execute(\"import bokeh.io; bokeh.io._nb_loaded = True\");\n",
       "      }\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.1.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.1.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.1.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.1.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i](window.Bokeh);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  if (window._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(this));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure, output_notebook, show\n",
    "\n",
    "# output to static HTML file\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"plotdiv\" id=\"0c928e75-8a83-4433-8567-af0d3dc41d1d\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(global) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = \"\";\n",
       "  \n",
       "    if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force !== \"\") {\n",
       "      window._bokeh_onload_callbacks = [];\n",
       "      window._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "    function run_callbacks() {\n",
       "      window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      delete window._bokeh_onload_callbacks\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      window._bokeh_onload_callbacks.push(callback);\n",
       "      if (window._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      window._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          window._bokeh_is_loading--;\n",
       "          if (window._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"0c928e75-8a83-4433-8567-af0d3dc41d1d\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid '0c928e75-8a83-4433-8567-af0d3dc41d1d' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        Bokeh.$(function() {\n",
       "            var docs_json = {\"2f67cdd6-c991-420a-9a8f-201c475eff67\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"152d5613-0e73-4209-a2dd-5239e9049405\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"9c6c2154-9c56-48a1-8cee-2ec818d2fe7b\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"6615cfdc-a34e-4068-916d-752f084f4ce7\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"18728c1f-d4e5-450d-98a5-47321e8906c1\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"880d46c9-e446-4492-97b6-56aeb709228d\",\"type\":\"BasicTicker\"}},\"id\":\"ba4a13c8-2441-4e2e-9ea3-629cf4791f80\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"9cdf092b-0297-4b57-a7cc-39903b73f61a\",\"type\":\"BasicTicker\"}},\"id\":\"4e5f81af-f3f6-448e-b90d-609bf7138eac\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null},\"id\":\"36612716-e88d-4f5c-a833-683587e80499\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"723b6719-836a-48f5-b02e-206dfd1bbacd\",\"type\":\"ToolEvents\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"6615cfdc-a34e-4068-916d-752f084f4ce7\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"9cdf092b-0297-4b57-a7cc-39903b73f61a\",\"type\":\"BasicTicker\"}},\"id\":\"937b0c5a-adb2-4de3-8539-d9c16c68b8a0\",\"type\":\"LinearAxis\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"e62700be-f78a-4728-9ff0-9c902c9dc12a\",\"type\":\"PanTool\"},{\"id\":\"152d5613-0e73-4209-a2dd-5239e9049405\",\"type\":\"WheelZoomTool\"},{\"id\":\"ee04375c-6d35-426e-862b-900b90fa11da\",\"type\":\"BoxZoomTool\"},{\"id\":\"f551600e-a025-4392-b5a8-0d7a7731fd9e\",\"type\":\"SaveTool\"},{\"id\":\"8168e541-b344-4dec-bd21-abd26c6b6312\",\"type\":\"ResetTool\"},{\"id\":\"9c6c2154-9c56-48a1-8cee-2ec818d2fe7b\",\"type\":\"HelpTool\"}]},\"id\":\"7225b276-2e31-40c1-a405-1de812a9366c\",\"type\":\"Toolbar\"},{\"attributes\":{\"legends\":[[\"Temp.\",[{\"id\":\"1541e2ec-bfb3-49d7-8356-14e1bc2a780d\",\"type\":\"GlyphRenderer\"}]]],\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"aa2da587-c8ca-4f78-a095-c60305ad217e\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"18728c1f-d4e5-450d-98a5-47321e8906c1\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"e62700be-f78a-4728-9ff0-9c902c9dc12a\",\"type\":\"PanTool\"},{\"attributes\":{\"overlay\":{\"id\":\"2e158594-6d0c-49cd-96c4-e5110aa3ec41\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"ee04375c-6d35-426e-862b-900b90fa11da\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"x\"],\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]}},\"id\":\"272c0b26-2a64-4029-8f27-8fbbec059556\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3012c46b-0ef6-4edb-86eb-189bcdb39d5f\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"8e2da4f6-4b1c-4e5e-953d-229d9dc968f2\",\"type\":\"Line\"},{\"attributes\":{\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"8168e541-b344-4dec-bd21-abd26c6b6312\",\"type\":\"ResetTool\"},{\"attributes\":{\"below\":[{\"id\":\"937b0c5a-adb2-4de3-8539-d9c16c68b8a0\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"ba4a13c8-2441-4e2e-9ea3-629cf4791f80\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"937b0c5a-adb2-4de3-8539-d9c16c68b8a0\",\"type\":\"LinearAxis\"},{\"id\":\"4e5f81af-f3f6-448e-b90d-609bf7138eac\",\"type\":\"Grid\"},{\"id\":\"ba4a13c8-2441-4e2e-9ea3-629cf4791f80\",\"type\":\"LinearAxis\"},{\"id\":\"e5d47d9b-8afa-47a1-bc5b-1192436d47a9\",\"type\":\"Grid\"},{\"id\":\"2e158594-6d0c-49cd-96c4-e5110aa3ec41\",\"type\":\"BoxAnnotation\"},{\"id\":\"aa2da587-c8ca-4f78-a095-c60305ad217e\",\"type\":\"Legend\"},{\"id\":\"1541e2ec-bfb3-49d7-8356-14e1bc2a780d\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"acfe2e43-d015-4941-89aa-da9d86c8d124\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"723b6719-836a-48f5-b02e-206dfd1bbacd\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"7225b276-2e31-40c1-a405-1de812a9366c\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"ce6b5c3f-1105-4060-b027-413e51afb248\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"36612716-e88d-4f5c-a833-683587e80499\",\"type\":\"DataRange1d\"}},\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"data_source\":{\"id\":\"272c0b26-2a64-4029-8f27-8fbbec059556\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"3012c46b-0ef6-4edb-86eb-189bcdb39d5f\",\"type\":\"Line\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"8e2da4f6-4b1c-4e5e-953d-229d9dc968f2\",\"type\":\"Line\"},\"selection_glyph\":null},\"id\":\"1541e2ec-bfb3-49d7-8356-14e1bc2a780d\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"f551600e-a025-4392-b5a8-0d7a7731fd9e\",\"type\":\"SaveTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"880d46c9-e446-4492-97b6-56aeb709228d\",\"type\":\"BasicTicker\"}},\"id\":\"e5d47d9b-8afa-47a1-bc5b-1192436d47a9\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null},\"id\":\"ce6b5c3f-1105-4060-b027-413e51afb248\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"880d46c9-e446-4492-97b6-56aeb709228d\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2e158594-6d0c-49cd-96c4-e5110aa3ec41\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"9cdf092b-0297-4b57-a7cc-39903b73f61a\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":null,\"text\":\"simple line example\"},\"id\":\"acfe2e43-d015-4941-89aa-da9d86c8d124\",\"type\":\"Title\"}],\"root_ids\":[\"48f4585b-4904-4e37-b11f-0735ce1d10a8\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.1\"}};\n",
       "            var render_items = [{\"docid\":\"2f67cdd6-c991-420a-9a8f-201c475eff67\",\"elementid\":\"0c928e75-8a83-4433-8567-af0d3dc41d1d\",\"modelid\":\"48f4585b-4904-4e37-b11f-0735ce1d10a8\",\"notebook_comms_target\":\"4362996a-8d43-41b1-92ce-39545b23eaa1\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "        });\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i](window.Bokeh);\n",
       "      }\n",
       "    }\n",
       "  \n",
       "    if (window._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(this));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<p><code>&lt;Bokeh Notebook handle for <strong>In[2]</strong>&gt;</code></p>"
      ],
      "text/plain": [
       "<bokeh.io._CommsHandle at 0x10d0c7810>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# prepare some data\n",
    "x = [1, 2, 3, 4, 5]\n",
    "y = [6, 7, 2, 4, 5]\n",
    "\n",
    "# create a new plot with a title and axis labels\n",
    "p = figure(title=\"simple line example\", x_axis_label='x', y_axis_label='y')\n",
    "\n",
    "# add a line renderer with legend and line thickness\n",
    "p.line(x, y, legend=\"Temp.\", line_width=2)\n",
    "\n",
    "# show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
